Skip to content

Козлов Александр#63

Open
KozlovAlexanderS wants to merge 1 commit intourfu-2016:masterfrom
KozlovAlexanderS:master
Open

Козлов Александр#63
KozlovAlexanderS wants to merge 1 commit intourfu-2016:masterfrom
KozlovAlexanderS:master

Conversation

@KozlovAlexanderS
Copy link
Copy Markdown

No description provided.

@honest-hrundel
Copy link
Copy Markdown

🍏 Пройдено тестов 15 из 15

var changedCollection = collection.map(function (el) {
return Object.assign({}, el);
});
functions.sort(function (first, second) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для функции сортировки можно параметры называть a и b

var fieldsToChoose = [].slice.call(arguments);

return function select(collection) {
return collection.map(function (el) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

el не несет никакой семантики, лучше подойдет название вроде person


return function select(collection) {
return collection.map(function (el) {
return fieldsToChoose.reduce(function (newCollection, property) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Первый аргумент назвал newCollection, но ведь это не коллеция, а объект с информацией о человеке

console.info(property, values);

return;
return function filterIn(collection) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Снова el никак не отражает того, что лежит внутри (в общем везде el нужно поменять)


return;
return function sortBy(collection) {
var changedCollection = collection.sort(function (first, second) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем еще одну переменную создавать? Можно просто collection.sort()

return function sortBy(collection) {
var changedCollection = collection.sort(function (first, second) {

return (first[property] > second[property]);
Copy link
Copy Markdown

@ninjagrizzly ninjagrizzly Nov 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Функция сравнения должна возвращать 1 (если first > second по некоторому критерию), 0 (если равны) и -1 (если меньше)

@ninjagrizzly
Copy link
Copy Markdown

🍅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants